<button class="btn btn-primary btn-xs" data-toggle="modal" data-target="#taskAllocation{{ $id }}">分配资源</button>

<div class="modal fade" id="taskAllocation{{ $id }}" tabindex="-1" role="dialog" aria-labelledby="taskAllocation"
     aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 36px;">&times;</button>
                <h4 class="modal-title" id="myModalLabel">分配资源(<span style="color:red; font-size:12px">公司内部资源分配</span>)</h4>
            </div>
            <div class="modal-body">
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">接受人</label>
                    <select type="text" name="allocationUserId{{ $id }}" class="form-control">

                        @if(!empty($user))
                            @foreach($user as $key => $value)
                                <option value="{{ $key }}">{{ $value }}</option>
                            @endforeach
                        @endif
                    </select>
                </div>
                <div style="overflow-x:auto;white-space:nowrap;">
                    <table class="table table-hover grid-table">
                        <thead>
                        <tr>
                            <th>实时任务进度(<span style="color:red; font-size:12px">分配次数：{{ count($data) }}次</span>)<</th>
                        </tr>
                        <tr>
                            <th>转赠人</th>
                            <th>有意向</th>
                            <th>无人接听</th>
                            <th>接通后挂断</th>
                            <th>无效</th>
                            <th>黑名单</th>
                            <th>完成进度</th>
                            <th>总任务数</th>
                            <th>时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if(!empty($data))
                            @foreach($data as $value)
                                <tr>
                                    <td>{{ $value['follow_user_name'] }}</td>
                                    <td>{{ $value['intentional_num'] }}</td>
                                    <td>{{ $value['none_reply_num'] }}</td>
                                    <td>{{ $value['hang_up_num'] }}</td>
                                    <td>{{ $value['invalid_num'] }}</td>
                                    <td>{{ $value['blacklist_num'] }}</td>
                                    <td>{{ $value['completion_progress_num'] }}</td>
                                    <td>{{ $value['total_task_num'] }}</td>
                                    <td>{{ date('Y-m-d H:i:s', strtotime($value['created_at'])) }}</td>
                                </tr>
                            @endforeach
                        @endif
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="taskAllocation({{ $id }})">提交</button>
            </div>
        </div>
    </div>
</div>
<script>
    function taskAllocation(id)
    {
        ajaxPostFunc('/admin/ajax/taskAllocation', {
            id: id,
            follow_user_id:$("select[name='allocationUserId"+id+"']").val(),
            _token: $.admin.token
        }, {}, res => {
            console.log(res);
            window.location.reload();
        });
    }
</script>
